layui.config({
    base : "/dhjdglxt/modules/util/"//自定义加载的模块
}).use(['form','layer','jquery','layedit','laydate','laypage','table','commUtil','element','treetable'],function(){
    var form = layui.form,
        layer = parent.layer === undefined ? layui.layer : parent.layer,
        laypage = layui.laypage,
        layedit = layui.layedit,
        laydate = layui.laydate,
        $ = layui.jquery;
    var table = layui.table;
    var commUtil = layui.commUtil;
    var element = layui.element;
    var treetable = layui.treetable;//很重要
 
  //监听提交
	form.on('submit(formSubmit)', function(data){
		layer.load(2); 
		var recId='0';
		if(data.field.recId!=''){
			recId=data.field.recId;
		}
		$.ajax({
		    type: "PUT",
		    url: basePath+'/service/jksxgl/jddtjksxgl/'+recId,
		    data: data.field,
		    async:true,
		    dataType: "json",
		    success: function(data){
		    	//console.log(data);
		    	layer.closeAll('loading');
		    	//debugger
		    	if(data.code=='0'){
		    		layer.msg("操作成功");
		    		 parent.location.reload();	
				}else if(data.code=='5'){
					console.log(data + "-----------------");
					layer.msg(data.message);
				} else {
					layer.msg("操作失败");
				}
		      }
		});
		return false;
	});
})